//
//  LYUserConfig.swift
//  LYOnlineBanking
//
//  Created by 李永彬 on 2025/7/20.
//

import UIKit

class LYUserConfig: NSObject {
    static let shared = LYUserConfig()
    
    override init() {
        super.init()
        NotificationCenter.default.addObserver(self, selector: #selector(logOut(_:)), name: .logOutNotificationKey, object: nil)
    }
    var isLogin: Bool {
        guard let _: String = LYUserDefaults.shared.get(forKey: userSessionIdKey) else { return false }
        return true
    }
    
    func removeLoginConfig() {
        LYUserDefaults.shared.remove(forKey: userSessionIdKey)
    }
    
    @objc func logOut(_ noti: Notification) {
        removeLoginConfig()
    }
}
